create function dbo.WeekBeginning(@CurDate datetime) 
returns
    datetime
as
begin
    return
	    convert(
		    smalldatetime,
		    convert(varchar(25),
		    dateadd(day,1-datepart(weekday,@CurDate),@CurDate),107))
end